package com.fxp.landing;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.print.DocFlavor.URL;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.event.AncestorEvent;
import javax.swing.event.AncestorListener;

public class XS extends JFrame {
	JPanel p1 = new JPanel();
	JLabel btn4, btn5, btn9;
	JButton btn6, btn10, btn7, btn8;
	private JTextField T1;
	private JPasswordField T2;
	JFrame jf,j,j1;
	public XS() {
		j=new JFrame();
//		super("学生登录系统");
		j.setTitle("学生登录系统");
		p1.setLayout(null);
		btn4 = new JLabel("账号");
		btn5 = new JLabel("密码");
		btn6 = new JButton("登     录");
		btn7 = new JButton("注  册");
		btn8 = new JButton("忘记密码");
		btn10 = new JButton("返回");

		btn9 = new JLabel();
		T1 = new JTextField(20);
		T1.setBounds(210, 228, 200, 30);
		T2 = new JPasswordField(20);
		T2.setBounds(210, 298, 200, 30);
		btn6.setBounds(180, 360, 200, 50);
		btn6.setFont(new Font("宋体", 00, 30));
		btn4.setBounds(150, 230, 100, 20);
		btn5.setBounds(150, 300, 100, 20);
		btn4.setFont(new Font("仿宋", WIDTH, 20));
		btn5.setFont(new Font("仿宋", WIDTH, 20));
		btn7.setBounds(10, 410, 100, 40);
		btn7.setFont(new Font("黑体", 00, 20));// 设置字体和大小
		btn8.setBounds(450, 410, 120, 40);// 设置按钮的位置和大小
		btn8.setFont(new Font("黑体", 00, 20));
		btn10.setBounds(10, 20, 60, 25);
		// Font f=new Font("btn10", Font.BOLD, 20);
		// UIManager.put(btn10, f);

		p1.add(btn5);
		p1.add(btn4);
		p1.add(btn6);
		p1.add(btn7);
		p1.add(btn8);
		p1.add(btn10);
		p1.add(btn9);
		p1.add(T1);
		p1.add(T2);
		j.add(p1);
		btn6.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
				j.setVisible(false);
				
			}
		});
		btn7.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent e) {
				j.setVisible(false);
				ZC zc = new ZC();
				
//				 jf=new JFrame();
//				 jf.setTitle("学生注册界面");
//				 JPanel p2;
//				 JTextField text1,text2,text3;
//				 JPasswordField pass1,pass2;
//				 JButton j1,j2;
//				 p2=new JPanel();
//				 p2.setLayout(null);
//				
//				 jf.add(p2);				
//				 jf.setSize(600,500);
//				 jf.setLocation(400, 500);
//				 jf.setVisible(true);

			}
		});
		btn10.addActionListener(new ActionListener() {

			@Override
			public void actionPerformed(ActionEvent arg0) {
				j.setVisible(false);
				Interfsce in = new Interfsce();
			}
		});
		
//		java.net.URL url = XS.class.getResource("1.jpeg");  插入图片
//		Icon icon = new ImageIcon(url); icon转换类
//		btn9.setIcon(icon);
//		btn9.setBounds(0, 0, 600, 500);
		
		btn8.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent arg0) {
					j.setVisible(false);
					 jf=new JFrame();
					 jf.setTitle("找回密码");
					 JPanel p2;
					 JTextField text1,text2;					
					 JButton j1,j2;
					 JLabel w1,w2;
					 p2=new JPanel();
					 p2.setLayout(null);
					 w1=new JLabel("找回账号");
					 w2=new JLabel("管理员密码");
					 text1=new JTextField(20);
					 text2=new JTextField(20);
					 j1=new JButton("确认");
					 j2=new JButton("返回");
					 w1.setBounds(40, 50, 80, 60);
					 w2.setBounds(40, 150, 100, 60);
					 		text1.setBounds(140, 60, 200, 30);
					 w1.setFont(new Font("宋体", 00, 20));
					 		text2.setBounds(140, 160, 200, 30);
					 w2.setFont(new Font("宋体", 00, 20));
					 j1.setBounds(120, 220, 90, 40);
					 j2.setBounds(10, 10, 60, 30);
					 p2.add(j2);
					 p2.add(j1);
					 p2.add(w2);
					 p2.add(w1);
					 p2.add(text1);
					 p2.add(text2);					 
					 jf.add(p2);	
					 
					 jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
					 jf.setSize(400,350);
					 jf.setLocation(400, 500);
					 jf.setVisible(true);
					 j2.addActionListener(new ActionListener() {
						
						@Override
						public void actionPerformed(ActionEvent arg0) {
								jf.setVisible(false);
							j.setVisible(true);
						}
					});
			}
		});
		j.setSize(600, 500);
		j.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		j.setLocation(400, 500);
		j.setVisible(true);
	}

	public static void main(String[] args) {
		new XS();
	}

}
